package com.qingcheng.util;

/**
 * @ProjectName: qingcheng_parent
 * @ClassName: BCryptTest
 * @Time: 2019/7/2
 * @Author: zhou24
 * @Description:
 * @Experience:
 */
public class BCryptTest {

    public static void main(String[] args) {
        //这个是盐  29个字符，随机生成
        String gensalt = BCrypt.gensalt();
        System.out.println(gensalt);
        String password = "123456";
        //根据盐对密码进行加密
        String hashpw = BCrypt.hashpw(password, gensalt);
        System.out.println(hashpw);
        //下面是密码校验过程
        //加密后的字符串前29位就是盐
        boolean checkpw = BCrypt.checkpw(password,hashpw);
        System.out.println(checkpw);

    }
}
